package com.rp.common.result;

import lombok.Getter;
import lombok.ToString;
import org.springframework.http.HttpStatus;

/**
 * 类说明:
 *
 * @author ****
 * @date 2020-11-23 16:07  新建
 */
@ToString
@Getter
public enum ResultDTOStatus {

    SUCCESS(HttpStatus.OK, 200, "OK",true),
    BAD_REQUEST(HttpStatus.BAD_REQUEST, 400, "失败的请求",false),
    INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, 500, "Internal Server Error",false),

    //  参数异常 1001 - 1999
    PARAM_IS_INVALID(HttpStatus.BAD_REQUEST, 1001, "参数无效",false),
    PARAM_IS_BLANK(HttpStatus.BAD_REQUEST, 1002, "参数为空",false),
    PARAM_TYPE_BIND_ERROR(HttpStatus.BAD_REQUEST, 1003, "参数类型错误",false),
    PARAM_NOT_COMPLETE(HttpStatus.BAD_REQUEST, 1004, "参数缺失",false),
    //  用户错误 2001 - 2999
    USER_NOT_LOGGED_IN(HttpStatus.BAD_REQUEST, 2001, "用户未登录",false),
    USER_LOGIN_ERROR(HttpStatus.BAD_REQUEST, 2002, "用户名或密码不正确",false),
    USER_ACCOUNT_FORBIDDEN(HttpStatus.BAD_REQUEST, 2003, "账号已禁用",false),
    USER_NOT_EXIST(HttpStatus.BAD_REQUEST, 2004, "用户不存在",false),
    USER_HAS_EXISTED(HttpStatus.BAD_REQUEST, 2005, "用户已存在",false),
    // 权限错误 3001 - 3999
    USER_ERROR_PERMISSION(HttpStatus.BAD_REQUEST, 3001, "权限认证失败",false),
    USER_NOT_PERMISSION(HttpStatus.BAD_REQUEST, 3002, "没有权限",false),;

    /** 返回的HTTP状态码,  符合http请求 */
    private HttpStatus httpStatus;
    /** 业务异常码 */
    private Integer code;
    /** 业务异常信息描述 */
    private String message;
    /** 是否请求成功 */
    private Boolean result;

    ResultDTOStatus(HttpStatus httpStatus, Integer code, String message, Boolean result) {
        this.httpStatus = httpStatus;
        this.code = code;
        this.message = message;
        this.result = result;
    }

}
